package com.cxhit.oss.aliyun;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

@RestController
public class UploadController {
    @Autowired
    private OssService ossService;

    //上传头像，返回图片的url给
    @PostMapping
    public String uploadOssFile(MultipartFile file){
        //获取上传文件 MultipartFile
        //返回图片在oss上的路径
        String url = ossService.upload(file);

        return url;
    }

}
